The rules to be followed by the different organizations in executable code are
defined in a smart contract. Invoking a smart contract enables the applications
to generate transactions that are recorded on the ledger.
A wide variety of possibilities in the industry can be opened up through smart
contracts turning them into executable programs on a blockchain network as a
smart contract implements the governance rules for business obj ects that are
automatically enforced when executed. For example, improving the flow of
goods or capital, looking to the funds being released as per prearranged terms,
or ensuring the car’s delivery in a specified timeframe enabled by a smart
contract. The smart contract’s execution is much more efficient when
compared to a business process done manually.
The lifecycle of a business obj ect in the world state is packed into a chaincode
and deployed on a blockchain network defined by the smart contract’s
transaction logic that controls it. The chaincode governs how smart contracts
are packaged for deployment, whereas the governance of transactions is done
by smart contracts.
When the application needs to interact with the ledger, an application external
to the blockchain invokes the smart contracts of Hyperledger Fabric which are
written in chaincode. In most cases, the chaincode interaction is done with the
database component, the world state and not the transaction log.
U sing programming languages, the chaincode can be implemented with Go
and Node currently supporting it. The Transport and Insurance chaincodes
are shown in the following figure:
Figure 6 .1: Transport and Insurance Chaincodes for Contracts
The smart contract with its multiple contracts is made available to applications
when a chaincode is deployed.